package tw.miku.model.gold.card.group;

import java.util.ArrayList;
import java.util.Random;

import tw.miku.model.ICard;
import tw.miku.model.gold.GoldUserType;
import tw.miku.model.gold.card.CharacterCard;

public class CharacterCardGroup extends AbstractCardGroup
{

	private final int userCount;

	// private int initCardCount;

	public CharacterCardGroup(int userCount)
	{
		this.userCount = userCount;
	}

	// public ArrayList<ICard> getInitCards()
	// {
	// return this.getCards(initCardCount);
	// }

	@Override
	public void generateCard()
	{
		int good = 0;
		int bad = 0;

		switch (userCount)
		{
		case 3:
		case 4:
			bad = 1;
			break;
		case 5:
		case 6:
			bad = 2;
			break;
		case 7:
		case 8:
		case 9:
			bad = 3;
			break;
		case 10:
			bad = 4;
			break;
		}

		good = userCount - bad + 1;

		for (int i = 0; i < good; i++)
		{
			CharacterCard card = new CharacterCard(GoldUserType.GOOD);
			cards.add(card);
		}
		Random r = new Random();

		for (int j = 0; j < bad; j++)
		{
			CharacterCard card = new CharacterCard(GoldUserType.BAD);
			cards.add(r.nextInt(cards.size()), card);
		}

	}
}
